package com.baomw.mybatis;

import com.baomw.servlet.Example2;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.stereotype.Component;

/**
 * @Description bean初始化的后置处理器的示例
 * @ClassName LubanBeanFactoryPostProcessor
 * @Author zenanFang
 * @Date 2019/8/19 9:06
 * @Version V1.0
 */
//@Component
public class LubanBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		GenericBeanDefinition beanDefinition = (GenericBeanDefinition) beanFactory.getBeanDefinition("example1");
		beanDefinition.setBeanClass(Example2.class);
	}
}
